Skip to content

fix(file_history): pin_local-safe Diff1/Diff1Inline for layout cycling#178

Merged
dlyongemallo merged 1 commit into
mainfrom
fix_live_layout_cycling
May 18, 2026
Merged

fix(file_history): pin_local-safe Diff1/Diff1Inline for layout cycling#178
dlyongemallo merged 1 commit into
mainfrom
fix_live_layout_cycling

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends file-history pin_local safety to single-pane Diff1/Diff1Inline layouts by introducing pinned siblings (Diff1Pinned, Diff1InlinePinned) that declare shared_symbols = { "b" } and inherit the swap-aware detach semantics from the existing Diff2 pinned variants. The view's get_default_layout / resolve_pinned_layout / unpinned_layout now route Diff1 names through these pinned forms so cycle_layout and set_layout keep the cycle reachable without dropping the view-owned working-tree file. Fixes a regression where a Diff1 entry in cycle_layouts.default caused cycling to stall on the default Diff2 orientation under pin_local.

Changes:

  • Add Diff1Pinned and Diff1InlinePinned classes with shared_symbols = { "b" } and detach_files_for_swap mirroring Diff2*Pinned.
  • Wire the new layouts into config.layout_map / LayoutName and into FileHistoryView's pinned_variant / unpinned_variant tables, simplifying the pinned-vs-unpinned resolution paths.
  • Switch Diff1Inline:owned_files to defer to Layout:owned_files (so subclass shared_symbols is honoured) and add unit/regression tests covering Diff1 pinned ownership, swap detach, cycling, and pinned-name fallbacks.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
lua/diffview/scene/layouts/diff_1_pinned.lua New pinned Diff1 layout with shared b-side and swap-aware detach.
lua/diffview/scene/layouts/diff_1_inline_pinned.lua New pinned Diff1Inline layout; borrows detach_files_for_swap from Diff1Pinned.
lua/diffview/scene/layouts/diff_1_inline.lua owned_files now delegates to Layout.owned_files so subclass shared_symbols is respected.
lua/diffview/scene/views/file_history/file_history_view.lua Add Diff1 entries to pinned_variant; simplify get_default_layout / resolve_pinned_layout fallback logic; updated docstrings.
lua/diffview/config.lua Register new pinned Diff1 names in LayoutName alias and layout_map; updated comment about pinned variants being internal.
lua/diffview/tests/functional/layouts_spec.lua New tests for Diff1*Pinned owned_files and detach_files_for_swap behaviour.
lua/diffview/tests/functional/pin_local_spec.lua Updated get_default_layout/resolve_pinned_layout/unpinned_layout tests for Diff1 pinned routing.
lua/diffview/tests/functional/cycle_layouts_spec.lua New regression tests covering pin_local cycling with Diff1 entries and pin_local on/off symmetry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lua/diffview/scene/layouts/diff_1_pinned.lua
@dlyongemallo dlyongemallo force-pushed the fix_live_layout_cycling branch from 6e8d3d6 to c4f9080 Compare May 18, 2026 14:35
@dlyongemallo dlyongemallo merged commit bcbe15c into main May 18, 2026
7 checks passed
@dlyongemallo dlyongemallo deleted the fix_live_layout_cycling branch May 18, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants